#include "Dot.h"
#include <QDebug>

Dot::Dot()
{

}

Dot::Dot(QPoint* point)
{
    m_point = point;
}

Dot::Dot(QPoint* point,QColor* color)
{
    m_point = point;
    m_color = color;
}

bool Dot::operator==(const Dot& other) const{
    return (this->point() == other.point());
}

void Dot::draw(QPainter* painter){
    if(!vertexs().isEmpty()) m_point = vertexs().first();
    if(!colors().isEmpty()) m_color = colors().first();
    if(m_color != 0)
    {
        QPen pen(*m_color, 2, Qt::SolidLine, Qt::FlatCap, Qt::MiterJoin);
        painter->setPen(pen);
    }
    painter->drawPoint(*m_point);
}

QPoint* Dot::point() const{
    return m_point;
}
void Dot::setPoint(QPoint* point) {
    m_point = point;
}
